<template>
	<view>
		<view class="success-img">
			<image class="" :src="typeImg == 1 ? '/static/index/success.png' : '/static/index/error.png'" mode="">
			</image>
		</view>
		<view class="success-title">
			{{title}}
		</view>
		<view class="success-btn" @click="navBack">
			{{typeBtn == 1 ? '继续抢购' : '返回'}}
		</view>
		<!-- 	<view class="success-btn" v-show="typeBtn == 1">
			继续抢购
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				typeImg: 1, //1 成功图片 2失败图片
				title: '抢购成功！', //标题
				typeBtn: 1 // 1 继续抢购 2 返回
			}
		},
		onLoad(options) {
			this.typeImg = options.typeImg;
			this.title = options.title;
			this.typeBtn = options.typeBtn;
			console.log(options, 111)
		},
		methods: {
			// 返回上一级
			navBack() {
				if (this.title == '抢购成功') {
					uni.navigateBack({
						delta: 2
					})
				} else {
					uni.navigateBack({
						delta: 1
					})
				}

			}
		}
	}
</script>

<style lang="scss">
	.success-img {
		width: 250rpx;
		height: 180rpx;
		margin: 0 auto;
		margin-top: 200rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.success-title {
		font-weight: bold;
		font-size: 32rpx;
		color: #000000;
		text-align: center;
		margin-top: 50rpx;
	}

	.success-btn {
		width: 320rpx;
		height: 72rpx;
		background: #FFFFFF;
		border-radius: 36rpx 36rpx 36rpx 36rpx;
		border: 1rpx solid #287E34;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #287E34;
		line-height: 72rpx;
		text-align: center;
		margin: 0 auto;
		margin-top: 50rpx;
	}
</style>